package com.xuchaotong.utils;

public class IntegerDemo {
    private int i = 33333;
    private Integer ii = 33333;

    public static void main(String[] args) {
        IntegerDemo instance = new IntegerDemo();
//        instance.test();
//        instance.test1();
//        instance.test2();
        instance.test3();
    }


    public void test(){
        Integer a = 33333;
        Integer b = 33333;
        Integer c = new Integer(10);
        Integer d = new Integer(10);
        Integer e = Integer.valueOf(10);
        Integer f = Integer.valueOf(10);
        int g = 33333;
        int h = 33333;

        System.out.println(a == b);
        System.out.println(c == d);
        System.out.println(e == f);
        System.out.println(g == h);
        System.out.println(a == g);
        System.out.println(a == ii);
    }


    public void test1(){
        Integer a = 1;
        Integer b = 2;
        Integer ai = new Integer(1);
        Integer bi = new Integer(2);

        Integer c = 3;

        Long h = 3L;
        Long g = 2L;


        System.out.println(c == (a + g));
        System.out.println(h.equals(a + b));
        System.out.println(c == (ai + bi));
        System.out.println(c.equals(ai + 2l));
    }

    public void test2(){
        Integer a = 123456;

        System.out.println(a.toString());
    }

    public void test3(){
        Integer f1 = 100,f2 = 100,f3 = 150,f4 = 150;
//        Integer t1 = new Integer(100);
//        Integer t2 = new Integer(100);
//        System.out.println(t1 == t2);
        System.out.println(f1 == f2);
        System.out.println(f3 == f4);
    }
}
